from flask import Flask
from flask import render_template
import json
from libapidoc import ApiDoc
from view3 import bp_v1
from views4 import bp_v2

app = Flask(__name__)
app.register_blueprint(bp_v2)
app.register_blueprint(bp_v1)




@app.route('/api-json', methods=['GET'])
def api_doc_json():
    docs_json = json.dumps({}, ensure_ascii=False)
    with open("./swagger.json", "r", encoding="utf-8") as fp:
        docs_json = fp.read()
    return docs_json


@app.route('/api', methods=['GET'])
def api_doc():
    return render_template('api_doc.html')


if __name__ == '__main__':
    ApiDoc.get_docs()
    # print(ApiDoc.docs)
    print(app.url_map)
    app.run(debug=True, port=5050)